package com.dragoncombin.homework.Problem03;

// 上网套餐
public class NetworkPackage extends AbstractPackage implements NetWorkServiceInterface{


    // 特征：上网流量、每月资费
    private int mobileData;

    // 分别自定义有参和无参构造方法
    public NetworkPackage() {
    }

    public NetworkPackage(int mobileData, int chargePerMonth) {
        setMobileData(mobileData);
        setChargePerMonth(chargePerMonth);
    }

    public int getMobileData() {
        return mobileData;
    }

    public void setMobileData(int mobileData) {
        this.mobileData = mobileData;
    }


    // 行为： 显示所有套餐信息
    public void show() {
        System.out.println("上网流量: " + getMobileData() + " MB");
        System.out.println("每月资费 : " + getChargePerMonth() + " 元");
    }

    @Override
    public void service(int mobileData, PhoneCard phoneCard) {
        phoneCard.setMobileData(phoneCard.getMobileData() + mobileData);
        System.out.println("卡号: " + phoneCard.getCardId() + "的机主 " + phoneCard.getUserName() + " 使用流量 " + mobileData + " MB");
    }
}
